<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    {$LOAD_STYLE.top|raw}
</head>
<body>
<form class="layui-form" action="">
    <div class="mainBox">
        <div class="main-container">
            
            {if !$action_up}
    		<div class="layui-form-item2 layui-col-md12">
    			<label class="layui-form-label">门市编号</label>
    			<div class="layui-input-block">
    			  <div id="fabric_id_search"></div>
                  <input id="fabric_id_hide" name="fabric_id" type="hidden" value="{$model.fabric_id??''}"/>
    			</div>
    		</div>
            {/if}
            
            <div class="layui-form-item2 layui-col-md3">
            	<label class="layui-form-label">门市色号</label>
            	<div class="layui-input-block">
            	  <input type="text" name="color_code" value="{$model.color_code??''}" placeholder="请输入色号" class="layui-input"  verify="must">
            	</div>
            </div>
            
            <div class="layui-form-item2 layui-col-md3">
            	<label class="layui-form-label">颜色名称</label>
            	<div class="layui-input-block">
            	  <input type="text" name="color_name" value="{$model.color_name??''}" placeholder="请输入颜色名称" class="layui-input" >
            	</div>
            </div>
            
            <div class="layui-form-item2 layui-col-md3">
            	<label class="layui-form-label">HEX颜色值</label>
            	<div class="layui-input-block">
            	  <div class="input-group layui-col-md12">
            	  <span class="input-group-addon" hex>#</span>
            	  <input type="text" name="color_hex" value="{$model.color_hex??''}" placeholder="请输入HEX颜色值" class="layui-input">
            	  </div>
            	</div>
            </div>
            
            <div class="layui-form-item2 layui-col-md3">
            	<label class="layui-form-label">门市加价</label>
            	<div class="layui-input-block">
            	  <input type="text" name="rose" value="{$model.rose??0}" placeholder="请输门市加价金额" class="layui-input" >
            	</div>
            </div>
            
            <div class="layui-form-item2 layui-col-md3">
            	<label class="layui-form-label">渠道色号</label>
            	<div class="layui-input-block">
            	  <input type="text" name="sup_color" value="{$model.sup_color??''}" placeholder="请输入渠道色号" class="layui-input">
            	</div>
            </div>

            <div class="layui-form-item2 layui-col-md3">
    			<label class="layui-form-label">渠道商</label>
    			<div class="layui-input-block">
    			  <div id="sup_id_search"></div>
                  <input name="sup_id" type="hidden" value="{$model.sup_id??''}"/>
    			</div>
    		</div>
            
			<div class="layui-form-item2 layui-col-md3">
				<label class="layui-form-label">渠道编号</label>
				<div class="layui-input-block">
				  <input type="text" name="sup_code" value="{$model.sup_code??''}" placeholder="请输入渠道编号" class="layui-input">
				</div>
			</div>
            
            <div class="layui-form-item2 layui-col-md3">
            	<label class="layui-form-label">供应商加价</label>
            	<div class="layui-input-block">
            	  <input type="text" name="rose" value="{$model.sup_rose??0}" placeholder="请输供应商加价金额" class="layui-input" >
            	</div>
            </div>
            
            <div class="layui-form-item">
            	<label class="layui-form-label">颜色类型</label>
            	<div class="layui-input-block">
            		{php}if(!$action_up) $model["gray"]=0;{/php}
            		{volist name="options.gray_radio" id="v"}
            		{if $v.id == $model.gray}
            		<input type="radio" name="gray" title="{$v.val}" value="{$v.id}" checked>
            		{else/}
            		<input type="radio" name="gray" title="{$v.val}" value="{$v.id}">
            		{/if}
            		{/volist}
            	</div>
            </div>
            
			<div class="layui-form-item2 layui-col-md4">
				<label class="layui-form-label">排序</label>
				<div class="layui-input-block">
				  <input type="text" name="sort" value="{$model.sort??1000}" placeholder="请输入排序" class="layui-input"  verify="must">
				</div>
			</div>
            
			<div class="layui-form-item">
				<label class="layui-form-label">状态</label>
				<div class="layui-input-block">
					<input type="checkbox" lay-skin="switch" value="status" lay-text="启用|禁用" {if $model.status??1 == 1} checked {/if}><input type="hidden" name="status" value="{$model.status??1}">
				</div>
			</div>

        </div>
    </div>
    <div class="bottom">
        <div class="button-container">
            <button type="button" class="pear-btn pear-btn-primary pear-btn-sm" lay-submit="" lay-filter="save" verify="submit">
                <i class="layui-icon layui-icon-ok"></i>
                提交
            </button>
            <button type="reset" class="layui-btn layui-btn-primary layui-btn-sm">
                <i class="layui-icon layui-icon-refresh"></i>
                重置
            </button>
        </div>
    </div>
</form>
<script>
	layui.use(['form', 'jquery', 'uploads','common','mycomm','table'], function () {
		let form = layui.form;
		let $ = layui.jquery;
		let common = layui.common;
		let mycomm = layui.mycomm;
		let table = layui.table;
		
		mycomm.editSubmit();
        
        $(document).ready(function(){
            $('[name="color_hex"]').change(function(){
            	$('[hex]').css("background",'#'+$(this).val());
            });
            
            $('#fabric_id_hide').change(function(){
            	
            });
        });

        // 调用 selectInput 函数，并传入 onClickCallback
        mycomm.selectInput(
            "fabric_id", 
            "{:U('fabric.Main/index')}", 
            "{$model.fabric_title??''}|{$model.fabric_id??''}", 
            "fabric_code", 
            "fabric_title", 
            null, // transformData 参数
            function(data) {
                $('[name="sup_id"]').val(data.item.sup_id);
                $('[name="sup_id_input"]').val(data.item.sup_name);
                $('[name="sup_code"]').val(data.item.sup_code);
            }
        );

        mycomm.selectInput("sup_id", "{:U('supplier.Main/index')}","{$model.sup_name??''}|{$model.sup_id??''}","sup_name","sup_name");
        

	})
</script>
{$LOAD_STYLE.bottom|raw}

</body>
</html>